Total Complexity | 8 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import React from 'react'; |
||
31 | |||
32 | export default class ValidationForm extends React.Component { |
||
33 | constructor(props) { |
||
34 | super(props); |
||
35 | this.formContext = new FormContext(); |
||
36 | } |
||
37 | |||
38 | getChildContext() { |
||
39 | return this.formContext; |
||
40 | } |
||
41 | |||
42 | componentWillMount() { |
||
43 | this.formContext.reset(); |
||
44 | } |
||
45 | |||
46 | componentDidMount() { |
||
47 | this.validate(); |
||
48 | } |
||
49 | |||
50 | validate() { |
||
51 | return this.formContext.validate(); |
||
52 | } |
||
53 | |||
54 | render() { |
||
55 | return ( |
||
56 | <form> |
||
57 | {this.props.children} |
||
58 | </form> |
||
59 | ); |
||
79 |